package org.example.platform.design.xiangyuan;

import java.util.Date;

public class ActivityController {
    RedisUtils redisUtils = new RedisUtils();



    public Activity queryActivityInfo(Long id) {
//        // 模拟从实际业务应用从接口中获取活动信息
//        Activity activity = new Activity();
//        activity.setId(10001L);
//        activity.setName("图书嗨乐");
//        activity.setDesc("图书优惠券分享激励分享活动第二期");
//        activity.setStartTime(new Date());
//        activity.setStopTime(new Date());
//        activity.setStock(new Stock(1000,1));
//        return activity;



        Activity a = ActivityFactory.run(id);
        // 模拟从redis中获取库存变化信息
        Stock stock  = new Stock(1000, redisUtils.getStockUsed());
        a.setStock(stock);
        return a;
    }
}
